package ynu.edu.api.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import ynu.edu.api.dto.ItemDTO;
import ynu.edu.api.dto.OrderDetailDTO;
import ynu.edu.common.domain.R;

import java.util.Collection;
import java.util.List;

@FeignClient("item-service")
public interface ItemClient {

    @GetMapping("/items")
    R<List<ItemDTO>> queryItemByIds(@RequestParam("ids") Collection<Long> ids);


    @PutMapping("/items/stock/deduct")
     R<Boolean> deductStock(@RequestBody List<OrderDetailDTO> items);

    @PutMapping("/items/stock/restore")
    R<Boolean> restoreStock(@RequestBody List<OrderDetailDTO> items);

    @PutMapping("/items")
     R<Boolean> updateItem(@RequestBody ItemDTO item);
}